<?php
/*********
*    首页控制器
*/
namespace Home\Controller;
use Home\Controller\HomeController;
class ArtController extends HomeController {
 	public function _initialize(){
 		parent::_initialize();
 		
 	}
 	/**
 	 */
	public function getArt(){
		$open_id = session('openid');
		$art = M('Art')->select();
		$this->ajaxReturn($art,'JSONP');
	}
	public function getDetails(){
		$id = I('art_id');
		$art = M('Art')->where('id ='.$id)->find();
		$art['content'] = html_entity_decode($art['content']);
		$a_array = explode('<',$art['content']);
		foreach($a_array as $k=>&$v){
		    $v = substr_replace($v,'http://sc-wscjf.91quyum.com',9,0);
		    if($k!=0){
		        $array_last[] = $v;
		    }
		}
		if(empty($array_last)){
		    $content = implode('<',$array_last);
		    $art['content'] =  "<".$content;
		}
		$art['add_time'] =  date("Y-m-d H:i:s",$art['add_time']);
		$this->ajaxReturn($art,'JSONP');
	}
	//获取客服电话
	public function getKefuPhone(){
		$r = M('Config')->where(array('key'=>'KEFU_PHONE'))->find();
		$this->ajaxReturn($r,'JSONP');
	}
	
}
